#pragma once
#include"const.h"
#include"data.h"
#include"MysqlDao.h"
class MySqlMgr:public Singleton<MySqlMgr>
{

	friend class Singleton<MySqlMgr>;
public:
	~MySqlMgr();
	bool text();
	int RegUser(const string& name,const string& pwd, const string& email);
	bool CheckEmail(const std::string& name, const std::string& email);
	bool UpdatePwd(const std::string& name, const std::string& pwd);
	bool CheckPwd(const std::string& name, const std::string& pwd, UserInfo& userinfo);
	bool GetApplyInfo(int login_uid, std::vector<std::shared_ptr<ApplyInfo>>& apply);
	bool AddFriendReq(const int& from_uid, const int& to_uid);
	int AuthFriendApply(const int& from_uid, const int& to_uid,const std::string& backname);
	bool GetFriendInfo(const int& self_uid,std::vector<std::shared_ptr<UserInfo>>& friend_List);
	std::shared_ptr<UserInfo> GetUser(int uid);
	std::shared_ptr<UserInfo> GetUser(string name);
private:
	MySqlMgr();
	MysqlDao dao_;
	std::shared_ptr<UserInfo> _user = nullptr;
};

